Fix broken unit test by updating RxJS catchError operators to RxJS 7+ API#1127
Merged
renemadsen merged 3 commits intomasterfrom Oct 28, 2025
Merged
Fix broken unit test by updating RxJS catchError operators to RxJS 7+ API#1127renemadsen merged 3 commits intomasterfrom
renemadsen merged 3 commits intomasterfrom
Conversation
Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix broken unit test in Angular
Fix broken unit test by updating RxJS catchError operators to RxJS 7+ API
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Angular unit tests were failing with the following errors:
And:
The test
download-excel-dialog.component.spec.tswas consistently failing, specifically the test case "should show error toast when download all workers fails".Root Cause
The code was using the deprecated RxJS 6 API signature for the
catchErroroperator:In RxJS 7+, the second parameter (
caught) was removed from thecatchErrorcallback signature. When the code tried to returncaught, it was actually returningundefined, which caused RxJS to throw the error "You provided an invalid object where a stream was expected".Solution
Updated all
catchErroroperators to use the RxJS 7+ API:Files Changed
download-excel-dialog.component.tscatchErrorinonDownloadExcelReportmethod by removing the unusedcaughtparameterworking-hours-header.component.tsEMPTYimport from 'rxjs'catchErrorinonDownloadExcelReportmethod - changed from returningcaught(undefined) toEMPTYcatchErrorinonDownloadExcelReportAllWorkersmethod - renamed misleading parameter and changed return value toEMPTYImpact
These changes ensure that when an error occurs during Excel report download operations, the error is properly caught, the user is notified via a toast message, and the observable chain completes gracefully. The unit tests should now pass without the invalid observable and navigation errors.
Original prompt
This section details on the original issue you should resolve
<issue_title>Fix broken unit test in angular</issue_title>
<issue_description>We get this error again and it needs to be fixed: